'use strict';var _Yr,_Ai;
{let a={};var _Da=_wj(function*(b,d,c=0){let e=b.id,f=a[e]=Math.random();"normal"!=b.state&&("maximized"==b.state&&(yield _fw(_Ps,{win:_Ba[e]|0})),yield _de([e],!0),b=(yield p=>_ye(e,!1,p))||b);let g=_2h(b);b=_kk(_ti(b),1/g);d={}.add(b,d);var l=d.x-b.x,h=d.y-b.y,m=d.w-b.w,q=d.h-b.h,k=Math.max(Math.abs(l),Math.abs(h),Math.abs(m),Math.abs(q));let r=25;c=c||r;k=Math.round(k/Math.max(1,k/c*r));const t=p=>n=>_Ky.windows.update(e,_7e(_kk(p,-1/g)),n);if(2>=k)g=_Jw(_Oh(d)),yield t(d);else{l/=k;h/=k;m/=k;
q/=k;r=c/k;c=-2/(k-1);for(let p=0,n=2;a[e]==f;n+=c)if(b.x+=l*n,b.y+=h*n,b.w+=m*n,b.h+=q*n,yield t(b),++p<k)yield _Pi(r);else{b.includes(d)||(g=_Jw(_Oh(d)),yield t(d));break}}})}function _Jw(a){return((_h[a]||{}).dpiX||96)/96}function _2h(a){return _Jw(_Jg(a))}function _Oa(a,b){const d=_2h(a);return 1==d?_ti(a).includes(b):Math.max(Math.abs(b.x-a.left*d),Math.abs(b.y-a.top*d),Math.abs(b.w-a.width*d),Math.abs(b.h-a.height*d))<=Math.max(2,10/Math.pow(d,2))}
function _Jg(a){a.monitorId||(a.monitorId=_Oh(_ti(a)));return a.monitorId}function _Oh(a){let b=-Infinity,d=0;for(let c in _h){let e=_Fw(_ue(a,_ti(_h[c].bounds)));e>b&&(b=e,d=c)}return d}function _No(a,b){let d=Math.max(1,Math.round(a.w/b.w))*b.w,c=Math.max(1,Math.round(a.h/b.h))*b.h;return{x:b.x+b.w*Math.round((a.x-b.x+a.w/2-d/2)/b.w),y:b.y+b.h*Math.round((a.y-b.y+a.h/2-c/2)/b.h),w:d,h:c}}
function _ii(a,b){b in _h||(b=Object.keys(_h)[0]);let d=_h[b].workArea;a=_9d(a,b);return{x:d.left,y:d.top,w:Math.round(d.width/a.cols),h:Math.round(d.height/a.rows)}}function _Qa(a){let b=0;for(let d in _h){let c=_Fw(_ue(a,_ti(_h[d].workArea)));0<c&&(b+=c)}return b}function _qy(a,b,d){let c="x"==d?"w":"h";return(Math.min(a[d]+a[c],b[d]+b[c])-Math.max(a[d],b[d]))/Math.min(a[c],b[c])}
function _ck(a,b,d,c){var e=b[c]-a[c];e/=Math.abs(e);for(a={}.add(a);;){let f=_Qa(a)/_Fw(a),g=_qy(d,a,c);if(.99<f||.99<g)break;a[c]+=e*b["x"==c?"w":"h"]}return a}function _ws(a,b,d){a={}.add(a);let c={}.add(a),e=0,f=!1;for(;;){let g=_Qa(c)/_Fw(c);if(.99<g){a.add(c);break}if(g>e)a.add(c),e=g;else if(f)break;else f=!0,c.add(a);c[d]-=b[d];f&&(c["w"==d?"x":"y"]+=b[d])}return a}
function _Hj(a,b,d,c){let e=_Oh(a),f=_ii(b,e);d=d?_ii(b,d):f;a=_No(a,f);let g=a.sc();for(let h of["x","y","w","h"]){let m=c[h]||{};if("val"in m){let q=+m.abs?"x"==h?d.x:"y"==h?d.y:0:a[h];var l=+m.abs?d:f;l=h.in("x","w")?l.w:l.h;a[h]=q+m.val*l;h.in("w","h")&&0>=a[h]&&(a[h]=l)}}a.includes(g)||(e=_Oh(a),f=_ii(b,e),a=_No(a,f));if(!_h[e])return _6p("badMonitorId",{monId:e,rect:a,MONITORS:_h}),a;b=_ti(_h[e].workArea);a=_ck(a,f,b,"x");a=_ck(a,f,b,"y");a=_ws(a,f,"w");return a=_ws(a,f,"h")}
function _cj(a,b){return _Kg(_h,a||_Oh(b),"workArea")||{left:0,top:0}}function _tt(a,b,d){a=a.sc();b=_cj(b,a);for(let c of["x","y","w","h"]){let e=d[c]||{};if("val"in e){let f="x"==c?b.left:"y"==c?b.top:0;a[c]=(+e.abs?f:a[c])+e.val;"w"==c&&(a[c]=Math.max(100,a[c]));"h"==c&&(a[c]=Math.max(25,a[c]))}}return a}
function _Uy(a,b,d){a=a.sc();b=_cj(b,a);for(let c of["x","y","w","h"]){let e=d[c]||{};if("val"in e){let f="x"==c?b.left:"y"==c?b.top:0,g=a[c.in("x","w")?"w":"h"];a[c]=(+e.abs?f:a[c])+g*e.val/100;"w"==c&&(a[c]=Math.max(100,a[c]));"h"==c&&(a[c]=Math.max(25,a[c]))}}return a}
function _Xj(a){let b=_er(a.gridLayout,"gridLayout").value,d=_9d(b,a.baseMonitor),c=+a.cols||+d.cols,e=+a.rows||+d.rows;return[function*(){let f=0,g=0;for(;;)yield _Hj({x:1,y:1,w:1,h:1},b,a.baseMonitor,{x:{abs:1,val:(a.x||0)+f},y:{abs:1,val:(a.y||0)+g},w:{abs:1,val:1},h:{abs:1,val:1}}),++f==c&&(f=0,++g==e&&(g=0))}(),c*e]}_2i.gridLayout={grid2x2:{name:"2 x 2 grid",value:{"*":{cols:2,rows:2}}},grid2x1:{name:"2 x 1 grid",value:{"*":{cols:2,rows:1}}},grid3x1:{name:"3 x 1 grid",value:{"*":{cols:3,rows:1}}}};
let _3i=_wj(function*(a){a=yield _fw(_Og,yield _ul(a));let b={};for(let [d,c]of a)b[_Rk[d]]=c;return b});
